﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint.Behaviors;

namespace CoreUnitTests
{
    public class BSPFieldCollectionExtension : BSPFieldCollection
    {
        public void CustomExtensions()
        {
            var mole = this.Holder;
            mole.ContainsFieldString = title =>
            {
                bool result = false;

                foreach (var field in this)
                {
                    if (field.Title == title)
                    {
                        result = true;
                        break;

                    }
                }
                return result;

            };


            mole.GetFieldByInternalNameString = title =>
            {
                BSPField result = null;

                foreach (var field in this)
                {
                    if (field.Title == title)
                    {
                        result = field;
                        break;

                    }
                }
                return result;

            };
        }
    }

}
